Imports EnvDTE
Imports EnvDTE80

Class ToolFactory
    Private Shared _FilePowerTool As FilePowerTool
    Private Shared _TemplatePowerTool As TemplatePowerTool


    Public Shared Function GetFromProject(ByVal project As Project) As BaseTool

        Select Case ProjectOptionsManager.ProjectType(project)
            Case EProjectType.Files
                If _FilePowerTool Is Nothing Then
                    _FilePowerTool = New FilePowerTool
                End If
                Return _FilePowerTool
            Case EProjectType.Templates
                If _TemplatePowerTool Is Nothing Then
                    _TemplatePowerTool = New TemplatePowerTool
                End If
                Return _TemplatePowerTool
            Case EProjectType.NotEnabled
                Throw New Exception("cannot get tool from a non-enabled project")
        End Select
        Return Nothing
    End Function
End Class